package com.dtw.ditouwang.ui.mine

import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.dtw.ditouwang.R
import com.dtw.ditouwang.beans.HelpBeanList
import com.dtw.ditouwang.ui.OnItemClickListener
import kotlinx.android.synthetic.main.item_help.view.*

class HelpListAdapter(var helpList:ArrayList<HelpBeanList.DataBean>):RecyclerView.Adapter<HelpListAdapter.Holder>(){
    var onItemClickListener:OnItemClickListener?=null

    override fun onCreateViewHolder(p0: ViewGroup, p1: Int): Holder {
        return Holder(LayoutInflater.from(p0.context).inflate(R.layout.item_help, p0, false))
    }

    override fun getItemCount(): Int {
        return helpList.size
    }

    override fun onBindViewHolder(p0: Holder, p1: Int) {
        p0.itemView.text_title.text=helpList[p1].title
    }

    inner class Holder(itemView: View) : RecyclerView.ViewHolder(itemView) {
init {
    itemView.setOnClickListener(){
        onItemClickListener?.onItemClick(0,adapterPosition,0)
    }
}
    }
}